Credit Card Fraud Detection

Anonymized credit card transactions labeled as fraudulent or genuine

The dataset contains transactions made by credit cards in September 2013 by European cardholders. This dataset presents transactions that occurred in two days, where we have 492 frauds out of 284,807 transactions. The dataset is highly unbalanced, the positive class (frauds) account for 0.172% of all transactions.

It contains only numerical input variables which are the result of a PCA transformation. Unfortunately, due to confidentiality issues, we cannot provide the original features and more background information about the data. Features V1, V2, … V28 are the principal components obtained with PCA, the only features which have not been transformed with PCA are 'Time' and 'Amount'. Feature 'Time' contains the seconds elapsed between each transaction and the first transaction in the dataset. The feature 'Amount' is the transaction Amount, this feature can be used for example-dependant cost-sensitive learning. Feature 'Class' is the response variable and it takes value 1 in case of fraud and 0 otherwise.

Data acquired from https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud

Exploratory Data Analysis

First, some exploratory data analysis to see the more obvious correlations between data and fraud identification variable 'Class'.

The best candidates for correlation to the fraud id variable 'class' are columns V2, V4, V8, V11.

There does appear to be some prominent clustering of data points relating to fraud (in orange) away from the valid transactions. The variables V2, V8, and V11 could be candidates for further exploration.

Interactive 3d plot

Worth looking at just the fraudulent transactions as much of this data is buried within the cloud of legitimate transactions.

2d scatter plot

It looks like V11 and V2 contain most of the useful information, and a simple scatterplot can show this.

Improving the detection of fraud.

One solution to the problem of fraud identification might be to use a least error line fit between V11 and V2 and use a cutoff within a band above and below the line. This is not a perfect solution. It is a tradeoff between fraudulent transactions stopped and genuine transactions stopped. The metrics can be tested later.

Reviewing the analysis so far, I will go with the ridiculously simple solution of blocking transactions where V11 is above 4.

Checking the solution

So a 43% decrease in credit card fraud (212 frauds stopped) but unfortunately this would mean that 60 valid transactions would also be stopped.

Conclusion

Although there is much more that can be done to improve the fraud detection rate and decrease false positive detections, this is an interesting problem that shows how a very simple solution can be found for a complex issue by using some data visualisation techniques. It would be interesting to compare the average values of the proposed blocked transactions with the overall average.

I confess I doubt the solution would stand the test of time. Fraud evolves and so must the solutions. Perhaps an adaptive machine learning algorithm would be better.